package com.shopping.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.shopping.dao.AdminDao;
import com.shopping.dao.Impl.IAdminsDao;
import com.shopping.model.Admins;
import com.shopping.service.IAdminsService;

@Service
public class AdminsServiceImpl implements IAdminsService{
	@Autowired
	private IAdminsDao dao;

	@Override
	public Admins login(String username, String password) {
		// TODO Auto-generated method stub
		return dao.login(username, password);
	}

	@Override
	public Integer adminCount() {
		// TODO Auto-generated method stub
		return dao.adminCount();
	}

	@Override
	public List<Admins> findAdmins(Integer pageSize, Integer page) {
		// TODO Auto-generated method stub
		int offset = (page-1)*pageSize;
		return dao.findAdmins(offset, pageSize);
	}

	@Override
	public Integer insertAdmin(Admins admin) {
		// TODO Auto-generated method stub
		return dao.insertAdmin(admin);
	}

	@Override
	public Integer delAdmin(Integer id) {
		// TODO Auto-generated method stub
		return dao.delAdmin(id);
	}

	@Override
	public Admins selByIdAdmin(Integer id) {
		// TODO Auto-generated method stub
		return dao.selByIdAdmin(id);
	}

	@Override
	public Integer redAdmin(String password, Integer id) {
		// TODO Auto-generated method stub
		return dao.redAdmin(password, id);
	}
	
	
}
